package com.future;

/**
 * Description:
 *
 * @author weiruibai.vendor
 * Date: 2022/7/29 14:10
 */
public class Solution_NC155 {

    public static void main(String[] args) {
        Solution_NC155 nc155 = new Solution_NC155();
        int[] nums = new int[]{7, 2, 3, 1, 5, 6};
        nums = new int[]{};
        System.out.println(nc155.maxSubArrayLengthTwo(nums));
    }

    public int maxSubArrayLengthTwo(int[] nums) {
        if(nums==null || nums.length==0){
            return 0;
        }
        int N = nums.length;
        if (N == 1) {
            return 1;
        }
        int ans = 0;
        int[] dp = new int[N];
        dp[0] = 1;
        for (int i = 1; i < N; i++) {
            int max = 0;
            for (int j = 0; j < i; j++) {
                if (nums[i] > nums[j]) {
                    max = Math.max(dp[j], max);
                }
            }
            max += 1;
            dp[i] = max;
            ans = Math.max(max, ans);
        }
        return ans;
    }
}
